home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 26
/
Cream of the Crop 26.iso
/
program
/
ddj0897.zip
/
RCSC.ZIP
/
PACKAGES
/
AWK320.ZIP
/
FMT.AWK
< prev
next >
Wrap
Text File
|
1990-02-08
|
440b
|
23 lines
# fmt - format
# input: text
# output: text formatted into lines of <= 60 characters
# AKW p120
/./ { for (i = 1; i <= NF; i++) addword($i) }
/^$/ { printline(); print "" }
END { printline() }
function addword(w) {
if (length(line) + length(w) > 60)
printline()
line = line " " w
}
function printline() {
if (length(line) > 0) {
print substr(line, 2)
line = ""
}
}